﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class kucunjia : System.Web.UI.Page
{
    private static string sqlconn = System.Configuration.ConfigurationManager.AppSettings["sqlcon"].ToString().Trim();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void enter_Click(object sender, EventArgs e)
    {
        if (txtspm.Text != "" && txtspbh.Text != "" && txtspwqy.Text != "" && txtspnqy.Text != "" && txtspnsl.Text != "" && txtspwsl.Text != "" && txtyouxiaoqi.Text != "")
        {
            users us = new users();
            us.dh = txtspm.Text.Trim();
            us.time = txtspbh.Text.Trim();
            us.id = txtspwqy.Text.Trim();
            us.name = txtspnqy.Text.Trim();
            us.number = txtspnsl.Text.Trim();
            us.tname = txtspwsl.Text.Trim();
            us.youxiaoqi = txtyouxiaoqi.Text.Trim();

            int result1 = us.kucun(us);
            if (result1 == 0)
            {
                int result = us.insertkucun(us);
                if (result != 0)
                {
                    lblyz.Visible = true;
                    lblyz.Text = "添加成功！";
                }
                else
                {
                    lblyz.Visible = true;
                    lblyz.Text = "添加失败！";
                }
            }
            else
            {
                lblyz.Visible = true;
                lblyz.Text = "此商品已存在！";
            }


        }
        else
        {
            lblyz.Visible = true;
            lblyz.Text = "输入框不得为空！";
        }
                              
        
    }
    protected void cancel_Click(object sender, EventArgs e)
    {
        lblyz.Visible = false;
        txtspm.Text = null;
        txtspbh.Text = null;
        txtspwqy.Text = null;
        txtspnqy.Text = null;
        txtspnsl.Text = null;
        txtspwsl.Text = null;
        txtyouxiaoqi.Text = null;
    }
}